<?php
/**
 * Created by PhpStorm.
 * User: zhangligang
 * Date: 17/4/24
 * Time: 上午12:00
 */

namespace App\Http\Service;

use Illuminate\Mail\Mailer;
use Illuminate\Mail\Message;

class EmailService extends Service
{

    private $mail;

    public function __construct(Mailer $mail)
    {
        $this->mail = $mail;

    }

    public function send(array $request)
    {
        $name = $request['name'];
        $to = $request['address'];
        $this->mail->send('emails.test',['name'=>$name],function($message) use ($to) {
            $message ->to($to)->subject('邮件测试');
        });
    }

}